:root {
  /* Shared tokens keep the interface consistent and make palette changes
     local: blue is the primary accent, while gold, rose, teal, and coral
     identify status and app-specific actions. */
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #eef4ff;
  background: #101724;
  --accent-color: #79a9ff;
  --accent-warm: #f5d27a;
  --accent-rose: #f28ca2;
  --accent-teal: #4ab4b5;
  --accent-coral: #e97c56;
}

.startup-screen,
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.fullscreen-prompt {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 101;
  padding: 10px 14px;
  border: 1px solid #7897c8;
  border-radius: 8px;
  background: #17243a;
  color: #eef4ff;
  font: inherit;
  cursor: pointer;
}

.startup-screen {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, #263e68 0, #101a2d 38%, #080d18 100%);
}

.startup-mark,
.login-mark {
  position: relative;
  z-index: 1;
  color: #f4f8ff;
  font-size: clamp(52px, 10vw, 108px);
  font-weight: 800;
  letter-spacing: -0.08em;
  text-shadow: 0 0 35px #79a9ff99;
}

.startup-mark span,
.login-mark span {
  color: var(--accent-warm);
}

.startup-status {
  position: absolute;
  bottom: 12%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aabbd3;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.startup-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid #526b96;
  border-top-color: var(--accent-warm);
  border-radius: 50%;
  animation: startup-spin 0.9s linear infinite;
}

.startup-orbit {
  position: absolute;
  width: 45vw;
  height: 45vw;
  min-width: 320px;
  min-height: 320px;
  border: 1px solid #79a9ff28;
  border-radius: 50%;
  animation: startup-pulse 2.4s ease-in-out infinite;
}

.startup-dot {
  --orbit-radius: min(22.5vw, 160px);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 10px;
  height: 10px;
  margin: -5px;
  transform-origin: center;
  animation: startup-dot-orbit 6s linear forwards;
}

.startup-dot span {
  display: block;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent-warm);
  box-shadow: 0 0 9px 3px #f5d27acc;
  transform: scaleX(2.38);
}

.startup-dot-trail {
  z-index: 1;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  animation-name: startup-dot-orbit;
}

.startup-dot-trail span {
  width: 7px;
  height: 7px;
  border-width: 1px;
  opacity: 0.78;
  transform: scaleX(2.38);
}

.trail-one {
  animation-delay: -1.2s;
  opacity: 0.82;
}

.trail-two {
  animation-delay: -2.4s;
  opacity: 0.64;
}

.trail-three {
  animation-delay: -3.6s;
  opacity: 0.46;
}

.trail-four {
  animation-delay: -4.8s;
  opacity: 0.3;
}

.orbit-one {
  transform: rotate(25deg) scaleX(0.42);
}

.orbit-two {
  transform: rotate(-25deg) scaleX(0.42);
  animation-delay: -1.2s;
}

.login-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0d1423, #182946 60%, #102033);
}

.login-card {
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid #a5c3f044;
  border-radius: 18px;
  background: #19263deF;
  box-shadow: 0 25px 80px #0008;
}

.login-mark {
  margin-bottom: 28px;
  font-size: 38px;
}

.login-eyebrow {
  margin: 0 0 7px;
  color: var(--accent-warm);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0;
  font-size: 25px;
}

.login-card .muted {
  margin: 10px 0 24px;
  line-height: 1.5;
}

#login-form {
  display: grid;
  gap: 9px;
}

#login-form label {
  color: #c9d7eb;
  font-size: 13px;
}

#username-input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #446083;
  border-radius: 7px;
  outline: 0;
  background: #111d30;
  color: #fff;
}

#username-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px #79a9ff2b;
}

#login-form button {
  margin-top: 8px;
  padding: 12px;
  border-radius: 7px;
  background: var(--accent-color);
  color: #fff;
}

#login-form button:hover {
  background: #7195d8;
}

@keyframes startup-spin {
  to { transform: rotate(360deg); }
}

@keyframes startup-pulse {
  0%, 100% { opacity: 0.35; transform: rotate(25deg) scaleX(0.42) scale(0.94); }
  50% { opacity: 0.9; transform: rotate(25deg) scaleX(0.42) scale(1.06); }
}

@keyframes startup-dot-orbit {
  from { transform: rotate(25deg) scaleX(0.42) translateY(calc(-1 * var(--orbit-radius))); }
  to { transform: rotate(385deg) scaleX(0.42) translateY(calc(-1 * var(--orbit-radius))); }
}

* {
  /* Border-box sizing makes width/height calculations predictable when
     we set explicit sizes on windows and cards. */
  box-sizing: border-box;
}

body {
  /* Fill the viewport and lock scrolling — the desktop itself is the
     scroll container and we never want a page-level scrollbar. */
  margin: 0;
  overflow: hidden;
}

/* Form controls inherit the platform font rather than the UA default. */
button,
input,
select,
textarea {
  font: inherit;
}

button {
  /* Strip the browser's default chrome so our look is consistent. */
  color: inherit;
  border: 0;
  cursor: pointer;
}

/* ===========================================================================
   2. DESKTOP SURFACE
   ========================================================================= */

.desktop {
  /* The "screen".  min-width ensures the layout doesn't collapse on very
     narrow viewports; overflow:hidden hides anything that drifts off-screen. */
  height: 100vh;
  min-width: 800px;
  position: relative;
  overflow: hidden;

  /* Keep the supplied wallpaper in the sibling image-assets folder. */
  background:
    url("img/12.png") center / cover no-repeat,
    radial-gradient(
      circle at 72% 12%,
      #263c65 0,
      #182946 28%,
      transparent 55%
    ),
    linear-gradient(135deg, #0d1423, #162641 60%, #102033);
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, var(--display-dimness, 0));
}

.desktop::after {
  /* Very subtle diagonal sheen for depth.  pointer-events:none keeps the
     overlay from stealing clicks from icons and windows. */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent 35%,
    rgba(109, 160, 253, 0.06) 35%,
    transparent 62%
  );
}

.desktop-icons {
  /* Shortcut column pinned to the top-left.  z-index:1 keeps icons above
     the ::after sheen but below any window (z-index:3+). */
  position: absolute;
  top: 24px;
  left: 18px;
  display: grid;
  gap: 10px;
  z-index: 1;
}

.desktop-icon {
  /* Each shortcut stacks its icon glyph above its label.  The transparent
     background becomes visible on hover/selection. */
  width: 82px;
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 5px 4px;
  border-radius: 8px;
  background: transparent;
  text-shadow: 0 1px 3px #000;
}

.desktop-icon:hover,
.desktop-icon.selected {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------------------------------------------------------------------------
   3. ICON PRIMITIVES
   Every shortcut and window title uses one of these small decorative glyphs.
   --------------------------------------------------------------------------- */

.icon {
  /* Shared sizing box so icons align regardless of the shape inside. */
  width: 34px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  position: relative;
}

.icon.small {
  /* Compact version used next to a window title. */
  width: 25px;
  margin-right: -5px;
  transform: scale(0.7);
  transform-origin: left center;
}

.app-image-icon {
  width: 34px;
  height: 34px;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: contain;
}

.app-image-icon.small {
  width: 25px;
  height: 25px;
  margin-right: -5px;
}

.folder-icon {
  /* A folder is a rounded rectangle with a tab ::before pseudo-element. */
  height: 23px;
  background: #78a9ed;
  border-radius: 3px;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.3);
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -5px;
  width: 15px;
  height: 7px;
  background: #78a9ed;
  border-radius: 3px 3px 0 0;
}

.file-icon {
  /* Paper-white rectangle with a "≡" glyph drawn by ::after. */
  width: 24px;
  height: 30px;
  border-radius: 3px;
  background: #e8effa;
}

.file-icon::after {
  content: "≡";
  color: #7094c2;
  font-size: 17px;
}

.gear-icon {
  /* Cheeky "gear" made from a dotted border.  The '+' inside the HTML
     is decorative. */
  color: #93b7ef;
  border: 4px dotted #93b7ef;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 900;
}

.note-icon {
  /* Yellow sticky note with a darker footer bar. */
  width: 25px;
  height: 29px;
  background: #ffcf73;
  border-radius: 3px;
  box-shadow: inset 0 -5px #e3a647;
}

.calculator-icon {
  /* Rounded square with an "=" glyph. */
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #79d6c1;
  border-radius: 7px;
  background: #215b5d;
  color: #d5fff5;
  font-size: 22px;
  font-weight: 700;
}

.calculator-icon.small {
  width: 25px;
  height: 25px;
  margin-right: -5px;
  font-size: 16px;
}

.calendar-icon {
  /* Small page with "31" written inside — behaves like a tear-off calendar. */
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #f4b96a;
  border-radius: 7px;
  background: #713f43;
  color: #fff2d7;
  font-size: 12px;
  font-weight: 800;
}

.calendar-icon.small {
  width: 25px;
  height: 25px;
  margin-right: -5px;
  font-size: 9px;
}

.music-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #f28ca2;
  border-radius: 8px;
  background: #713f58;
  color: #ffe8ef;
  font-size: 22px;
  font-weight: 800;
}

.music-icon.small {
  width: 25px;
  height: 25px;
  margin-right: -5px;
  font-size: 16px;
}

.terminal-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #79d6c1;
  border-radius: 7px;
  background: #173d45;
  color: #b8fff0;
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.terminal-icon.small {
  width: 25px;
  height: 25px;
  margin-right: -5px;
  font-size: 9px;
}

/* ===========================================================================
   4. WINDOW CHROME (shared by every app window)
   ========================================================================= */

.window {
  /* Local opacity tokens.  JS may override them per-element to implement
     the "window transparency" setting in Personalization. */
  --window-surface-alpha: 0.97;
  --window-header-alpha: 0.75;
  --window-border-alpha: 0.28;

  position: absolute;
  z-index: 3;
  left: 22%;
  top: 12%;
  width: 65%;
  height: 70%;
  min-width: 560px;
  min-height: 360px;
  max-width: calc(78vw - 16px);
  max-height: calc(88vh - 67px);

  /* Flex column so header sits on top and body stretches to fill the rest. */
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Native resize grip in the bottom-right corner. */
  resize: both;
  cursor: default;

  background: rgba(24, 34, 51, var(--window-surface-alpha));
  border: 1px solid rgba(165, 195, 240, var(--window-border-alpha));
  border-radius: 12px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
}

.window.focused {
  /* The script keeps this class on exactly one visible window. */
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(120, 170, 255, 0.35);
}

.window.maximized {
  /* Fill the desktop below the taskbar without retaining normal-window limits. */
  top: 8px;
  right: 8px;
  bottom: 58px;
  left: 8px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  resize: none;
}

.terminal-window {
  left: 16%;
  top: 10%;
  width: 69%;
  height: 74%;
  background: #0a111b;
  border-color: #2b665f;
}

.terminal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 15%, #1a5b5b22, transparent 35%),
    #0a111b;
  color: #c8f7e9;
  font-family: Consolas, "Courier New", monospace;
}

.terminal-banner {
  color: #7ee7ce;
  font-size: clamp(32px, 6vw, 62px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 0 22px #42d8b477;
}

.terminal-banner span {
  color: #f5d27a;
}

.terminal-subtitle {
  margin: 4px 0 20px;
  color: #729b95;
  font-size: 12px;
}

.terminal-output {
  display: grid;
  flex: 1;
  gap: 6px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
}

.terminal-line {
  color: #b5e7d9;
}

.terminal-line.command {
  color: #f5d27a;
}

.terminal-line.error {
  color: #ff9b9b;
}

.terminal-prompt {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  border-top: 1px solid #21433f;
  padding-top: 14px;
}

.terminal-prompt-label {
  color: #7ee7ce;
  font-weight: 700;
}

.terminal-prompt input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f4f8ff;
  font: inherit;
}

.window-header {
  /* Flex row: title on the left, actions on the right.  Fixed 48 px
     height so every app's body starts at the same y. */
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 17px;
  background: rgba(46, 61, 85, var(--window-header-alpha));
  user-select: none;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.window-actions {
  display: flex;
  gap: 3px;
}

.window-actions button {
  /* Square ghost buttons; the red tint on :last-child signals "close". */
  width: 34px;
  height: 30px;
  border-radius: 5px;
  background: transparent;
  color: #cad7ea;
}

.window-actions button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.window-actions button:last-child:hover {
  background: #d45463;
}

/* Quick-notes opens smaller than the default window and cannot be maximised. */
.small-window {
  left: 38%;
  top: 22%;
  width: 360px;
  min-width: 320px;
  height: 300px;
  min-height: 240px;
}

/* Per-app default positions so different apps don't overlap exactly. */
.calculator-window { left: 19%; top:  9%; width: 68%; height: 77%; }
.calendar-window   { left: 13%; top:  8%; width: 74%; height: 79%; }
.music-window      { left: 15%; top:  8%; width: 72%; height: 80%; }
/* ---------------------------------------------------------------------------
   5a. CALENDAR APP
   --------------------------------------------------------------------------- */

.calendar-layout {
  display: flex;
  flex: 1;
  min-height: 0;   /* lets the child scroll instead of stretching the parent */
}

.calendar-main {
  flex: 1;
  min-width: 430px;
  padding: 18px 22px 22px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.calendar-picker select {
  min-width: 125px;
  padding: 8px 26px 8px 9px;
  font-size: 16px;
}

.calendar-picker.year-picker select {
  min-width: 88px;
}

/* Standard SR-only pattern: visually hidden but readable by screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.calendar-today,
.calendar-nav,
.calendar-event-form button {
  padding: 8px 13px;
  border-radius: 6px;
  background: #2d4668;
  color: #eaf2ff;
}

.calendar-nav {
  width: 34px;
  padding: 5px;
  font-size: 22px;
  line-height: 1;
}

.calendar-today:hover,
.calendar-nav:hover,
.calendar-event-form button:hover {
  background: #466a9a;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.calendar-weekdays {
  margin-bottom: 5px;
  color: #8da3c1;
  font-size: 12px;
  text-align: center;
}

.calendar-day {
  /* A single day cell — also a <button>, so it must reset button styling. */
  position: relative;
  min-height: 57px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #202f47;
  color: #eaf2ff;
  text-align: left;
}

.calendar-day:hover       { background: #30496e; }
.calendar-day.today       { border-color: #79a9ff; color: #fff; }
.calendar-day.selected    { background: #3d5e8d; box-shadow: inset 0 -3px #9ac1ff; }
.calendar-day.blank       { background: transparent; cursor: default; }

.calendar-event-dot {
  /* Small orange dot shown in the corner of days that have events. */
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f4b96a;
}

.calendar-details {
  width: 275px;
  padding: 20px 18px;
  border-left: 1px solid #2d3b51;
  overflow: auto;
}

.calendar-details h3 {
  margin: 3px 0 16px;
  color: #fff;
  font-size: 17px;
}

.calendar-events {
  display: grid;
  gap: 7px;
  margin-bottom: 22px;
}

.calendar-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  border-radius: 6px;
  background: #202f47;
  color: #dce7f8;
  font-size: 13px;
}

.calendar-event button {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 4px;
  background: transparent;
  color: #aabbd3;
}

.calendar-event button:hover {
  background: #d45463;
  color: #fff;
}

.calendar-event-form {
  display: grid;
  gap: 12px;
}

.calendar-event-form label {
  display: grid;
  gap: 5px;
  color: #aabbd3;
  font-size: 13px;
}

.calendar-event-form input {
  width: 100%;
  padding: 9px;
  border: 1px solid #446083;
  border-radius: 6px;
  background: #142137;
  color: #fff;
}

/* ---------------------------------------------------------------------------
   5b. MUSIC PLAYER APP
   --------------------------------------------------------------------------- */

.music-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.music-main {
  flex: 1;
  min-width: 360px;
  padding: 28px;
}

.music-now-playing {
  /* "Album art" card that contains the spinning disc + track title. */
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 150px;
  padding: 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, #293f66, #202d49);
}

.music-now-playing p,
.music-now-playing h2 { margin: 0; }

.music-now-playing h2 {
  max-width: 480px;
  margin-top: 6px;
  font-size: 21px;
}

.music-disc {
  /* Decorative vinyl: solid ring with two box-shadows making concentric
     borders without extra DOM nodes. */
  width: 104px;
  height: 104px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 8px solid #536fa4;
  border-radius: 50%;
  background: #151f34;
  color: #f28ca2;
  font-size: 44px;
  box-shadow: 0 0 0 8px #334c76, 0 12px 30px #0006;
}

.music-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  color: #aabbd3;
  font-size: 12px;
}

.music-progress input {
  flex: 1;
  accent-color: var(--accent-rose);
}

.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.music-controls button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #293f63;
  color: #eaf2ff;
}

.music-controls button:hover,
.music-controls button[aria-pressed="true"] {
  /* aria-pressed doubles as the "toggled on" state for shuffle/repeat. */
  background: #496b9f;
}

.music-controls .music-play-button {
  width: 54px;
  height: 54px;
  background: #c96780;
  font-size: 20px;
}

.music-controls .music-play-button:hover { background: #e18198; }

.music-volume {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 23px;
  color: #aabbd3;
  font-size: 13px;
}

.music-volume input {
  width: 180px;
  accent-color: var(--accent-rose);
}

.music-library {
  width: 330px;
  padding: 22px 15px;
  border-left: 1px solid #2d3b51;
  overflow: auto;
}

.music-library-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 5px 12px;
}

.music-library-heading > div {
  display: grid;
  gap: 3px;
}

.music-library-heading h2 {
  margin: 0;
  font-size: 18px;
}

.music-add-button {
  padding: 7px 9px;
  border-radius: 6px;
  background: #293f63;
  color: #dce7f8;
  cursor: pointer;
  font-size: 12px;
}

.music-add-button:hover {
  background: #385a85;
}

.music-add-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.music-track-list {
  display: grid;
  gap: 5px;
}

.music-track {
  /* Row: index number | track title.  Selected state uses .active. */
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  width: 100%;
  padding: 10px 8px;
  border-radius: 7px;
  background: transparent;
  color: #dce7f8;
  text-align: left;
}

.music-track:hover,
.music-track.active {
  background: #2c4364;
}

.music-track-number {
  color: #8da3c1;
  text-align: center;
}

.music-track-name {
  /* Long filenames truncate with an ellipsis instead of wrapping. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   5c. CALCULATOR APP
   --------------------------------------------------------------------------- */

.calculator-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.calculator-main {
  flex: 1;
  min-width: 390px;
  padding: 20px;
}

.calculator-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.calculator-tab {
  padding: 8px 18px;
  border-radius: 18px;
  background: #253650;
  color: #aabbd3;
}

.calculator-tab.active,
.calculator-tab:hover {
  background: var(--accent-color);
  color: #fff;
}

.calculator-display {
  /* Two-line readout: pending expression above, current value below. */
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 7px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border: 1px solid #385275;
  border-radius: 10px;
  background: #111d30;
}

.calculator-expression {
  min-height: 18px;
  color: #8da3c1;
  font-size: 13px;
}

.calculator-display output {
  max-width: 100%;
  overflow: hidden;
  color: #f4f8ff;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.scientific-keypad {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.scientific-keypad button {
  font-size: 16px;
  text-transform: none;
}

.keypad button {
  min-height: 52px;
  border-radius: 8px;
  background: #263b5b;
  color: #eef4ff;
  font-size: 18px;
}

.keypad button:hover   { background: #385a85; }
.keypad .operator      { background: #315177; color: #a9d1ff; }
.keypad .equals        { background: var(--accent-color); color: #fff; }

.keypad .zero {
  /* "0" spans two columns so the equals key lines up on the right. */
  grid-column: span 2;
}

.calculator-history {
  width: 250px;
  padding: 20px 16px;
  border-left: 1px solid #2d3b51;
  overflow: auto;
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-heading button {
  padding: 5px 8px;
  border-radius: 5px;
  background: #293952;
  color: #aabbd3;
}

.history-item {
  /* History entry doubles as a button that recalls the result. */
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px 8px;
  border-bottom: 1px solid #2d3b51;
  text-align: right;
  background: transparent;
}

.history-item:hover { background: #263b5b; }
.history-item span  { color: #8da3c1; font-size: 11px; }
.history-item strong{ color: #fff; font-size: 15px; }

/* ---------------------------------------------------------------------------
   5d. FILE EXPLORER APP
   --------------------------------------------------------------------------- */

.file-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid #2d3b51;
}

.toolbar-button,
.new-button {
  padding: 8px 11px;
  border-radius: 6px;
  background: #293952;
  color: #dce7f8;
}

.toolbar-button:hover,
.new-button:hover {
  background: #385174;
}

.toolbar-button:disabled {
  /* Visually communicates "no history to go back/forward to". */
  cursor: not-allowed;
  opacity: 0.45;
}

.address-form {
  flex: 1;
  display: flex;
  min-width: 0;
  gap: 9px;
}

.address-bar {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #172337;
  color: #9eb2ce;
}

.address-bar:focus {
  border-color: #79a9ff;
  outline: 0;
  color: #eef4ff;
}

.address-bar[aria-invalid="true"] {
  border-color: #ff8585;
}

.address-message {
  color: #ff9b9b;
  font-size: 12px;
  white-space: nowrap;
}

.file-layout,
.settings-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.file-sidebar,
.settings-nav {
  width: 190px;
  padding: 15px 9px;
  border-right: 1px solid #2d3b51;
}

.nav-item,
.settings-item {
  width: 100%;
  margin-bottom: 3px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 6px;
  background: transparent;
  color: #aabbd3;
}

.nav-item:hover,
.settings-item:hover,
.nav-item.active,
.settings-item.active {
  color: #fff;
  background: var(--accent-color);
}

.nav-item:focus-visible,
.settings-item:focus-visible,
.toolbar-button:focus-visible,
.file-card:focus-visible,
.new-button:focus-visible {
  /* Visible focus ring for keyboard users. */
  outline: 2px solid #79a9ff;
  outline-offset: 2px;
}

.file-content,
.settings-content {
  flex: 1;
  padding: 22px;
  overflow: auto;
}

.content-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 600;
}

.file-grid {
  /* Fluid grid that fills the available width with ~135 px cards. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
}

.file-card {
  display: grid;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  justify-items: start;
  gap: 6px;
  padding: 17px 14px;
  text-align: left;
  border-radius: 8px;
  background: #202f47;
}

.file-card-name {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.file-card:hover,
.file-card.selected {
  background: #30496e;
}

.file-card small,
.recommended small {
  color: #8da3c1;
  font-size: 11px;
}

/* ---------------------------------------------------------------------------
   5e. SETTINGS APP
   --------------------------------------------------------------------------- */

.settings-content h2 {
  margin: 0 0 4px;
  font-size: 23px;
}

.settings-content h3 {
  margin: 20px 0 0;
  color: #dce7f8;
  font-size: 15px;
}

.settings-nav {
  flex: 0 0 190px;
  overflow-y: auto;
}

.settings-page > .muted {
  margin: 6px 0 18px;
}

.muted {
  /* Secondary-text helper used throughout the shell. */
  color: #8da3c1;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 520px;
  gap: 16px;
  padding: 17px 0;
  border-bottom: 1px solid #2d3b51;
}

.setting-row input[type="range"] {
  width: 180px;
  accent-color: #79a9ff;
  margin-left: auto;
}

.setting-row output {
  min-width: 42px;
  color: #aabbd3;
  text-align: right;
}

.settings-group {
  max-width: 520px;
}

.settings-group .setting-row {
  max-width: none;
  padding: 12px 0;
}

select {
  padding: 7px 28px 7px 10px;
  border: 1px solid #446083;
  border-radius: 5px;
  background: #25364f;
  color: #fff;
}

.device-card {
  display: grid;
  gap: 5px;
  max-width: 520px;
  margin-top: 22px;
  padding: 16px;
  border-radius: 8px;
  background: #202f47;
  color: #aabbd3;
}

.device-card strong { color: #fff; }

.background-character {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #2d3b51;
  border-radius: 8px;
  background: #202f47;
}

.background-character h3 {
  margin-top: 0;
}

.background-character p {
  margin: 6px 0 14px;
}

.background-picker,
.background-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.background-picker,
.system-button {
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid #446083;
  border-radius: 6px;
  background: #25364f;
  color: #eef4ff;
  cursor: pointer;
}

.background-picker:hover,
.system-button:hover {
  background: #30496e;
}

.background-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.background-status {
  justify-content: space-between;
  margin-top: 12px;
  color: #aabbd3;
  font-size: 12px;
}

.account-card,
.update-status-card,
.storage-card {
  max-width: 520px;
  padding: 16px;
  border: 1px solid #2d3b51;
  border-radius: 8px;
  background: #202f47;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-card > div,
.update-status-card {
  display: grid;
  gap: 5px;
}

.account-avatar {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
}

.connection-status {
  color: #8fe0b0;
}

.update-status-card {
  color: #aabbd3;
}

.update-status-card strong {
  color: #8fe0b0;
  font-size: 16px;
}

.settings-app-list {
  display: grid;
  max-width: 520px;
  gap: 8px;
}

.settings-app-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #2d3b51;
  border-radius: 8px;
  background: #202f47;
}

.settings-app-item strong {
  flex: 1;
}

.settings-app-item .system-button {
  flex: 0 0 auto;
}

.settings-app-item:focus-within {
  border-color: var(--accent-color);
}

.storage-card {
  display: grid;
  gap: 14px;
}

.storage-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.storage-summary strong {
  color: #fff;
  font-size: 20px;
}

.storage-summary span {
  color: #aabbd3;
}

.storage-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #101724;
}

.storage-meter span {
  display: block;
  width: 71.875%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-color);
}

/* ---------------------------------------------------------------------------
   5f. QUICK NOTES APP
   --------------------------------------------------------------------------- */

.notes-area {
  flex: 1;
  padding: 18px;
  resize: none;
  border: 0;
  outline: 0;
  background: #172337;
  color: #eef4ff;
}

/* ===========================================================================
   6. START MENU & SEARCH POP-UPS
   ========================================================================= */

.start-menu,
.search-panel {
  /* Two panels share almost all styling; only their left offset differs. */
  position: absolute;
  z-index: 10;
  bottom: 59px;
  width: 490px;
  padding: 20px;
  border: 1px solid rgba(165, 195, 240, 0.25);
  border-radius: 12px;
  background: rgba(25, 37, 57, 0.98);
  box-shadow: 0 18px 55px #0008;
}

.start-menu  { left: 14px; }   /* anchored above the Start button */
.search-panel{ left: 78px; }   /* nudged right so it doesn't cover Start */

.start-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #7096d4;
}

.power-button {
  padding: 8px;
  background: transparent;
  font-size: 20px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0;
  padding: 10px 13px;
  border: 1px solid #3d5577;
  border-radius: 7px;
  background: #142137;
  color: #8da3c1;
}

.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
}

.search-box.large { margin: 0; }   /* used inside the standalone search panel */

h3 {
  color: #aabbd3;
  font-size: 13px;
  font-weight: 600;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.app-grid button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 7px;
  padding: 9px;
  text-align: left;
  border-radius: 7px;
  background: transparent;
}

.app-grid button:hover,
.recommended button:hover {
  background: #2c4364;
}

.app-tile {
  /* The coloured rounded square next to each pinned-app name. */
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-weight: 700;
}

.app-image-tile {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: contain;
}

/* Tile colours: each app has its own brand hue. */
.blue   { background: #4d8ee5; }
.purple { background: #986fe0; }
.yellow { background: #e3ac4e; }
.green  { background: #5dad79; }
.red    { background: #d86e78; }
.teal   { background: #4ab4b5; }

.recommended {
  margin-top: 14px;
  padding-top: 5px;
  border-top: 1px solid #2d3b51;
}

.recommended button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px;
  text-align: left;
  background: transparent;
}

.recommended span:last-child {
  display: grid;
  gap: 3px;
}

.search-panel .muted {
  margin: 16px 4px 0;
}

.search-results {
  display: grid;
  gap: 4px;
  max-height: 260px;
  margin-top: 8px;
  overflow-y: auto;
}

.search-result {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 6px;
  background: transparent;
  color: #dce7f8;
  text-align: left;
}

.search-result:hover,
.search-result:focus-visible {
  background: #2c4364;
}

.search-result small {
  color: #aabbd3;
}

/* ===========================================================================
   7. TASKBAR
   ========================================================================= */

.taskbar {
  position: absolute;
  z-index: 20;             /* always above windows */
  right: 0;
  bottom: 0;
  left: 0;
  height: 51px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-top: 1px solid rgba(160, 190, 235, 0.16);
  background: rgba(15, 24, 39, 0.91);
  backdrop-filter: blur(18px);   /* frosted-glass effect */
}

.task-button,
.status-button {
  height: 39px;
  border-radius: 7px;
  background: transparent;
  color: #cfdbec;
}

.task-button,
.status-button {
  min-width: 37px;
}

.clock {
  min-width: 66px;
  height: 39px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: transparent;
  color: #cfdbec;
  font-size: 12px;
}

.task-button:hover,
.status-button:hover,
.clock:hover {
  background: #2b3f5d;
}

.launcher {
  color: #8fb8ff;
  font-size: 23px;
}

.task-divider {
  width: 1px;
  height: 25px;
  margin: 0 4px;
  background: #3a4a61;
}

.task-apps {
  display: flex;
  gap: 4px;
}

.task-app {
  display: inline-flex;
  min-width: 42px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.task-app img {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
}

.task-app.active {
  /* Current foreground app: subtle background + underline accent. */
  background: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}

/* --- taskbar status fly-outs --------------------------------------------- */

.sound-control,
.wifi-control,
.clock-control {
  position: relative; /* Anchor each fly-out to its taskbar control. */
}

.sound-flyout,
.wifi-flyout,
.clock-flyout {
  position: absolute;
  right: 0;
  bottom: 47px; /* Lift panels above the taskbar. */
  border: 1px solid rgba(165, 195, 240, 0.25);
  border-radius: 9px;
  background: rgba(25, 37, 57, 0.98);
  box-shadow: 0 15px 35px #0008;
}

.sound-flyout {
  width: 245px;
  padding: 14px;
}

.wifi-flyout {
  width: 245px;
  padding: 14px;
}

.clock-flyout {
  display: grid;
  gap: 5px;
  min-width: 220px;
  padding: 16px;
}

.clock-flyout-time {
  color: #dce7f8;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.clock-flyout-date {
  color: #aabbd3;
  font-size: 13px;
}

.wifi-network {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #dce7f8;
  font-size: 13px;
}

.wifi-network-icon {
  color: #79a9ff;
  font-size: 16px;
}

.wifi-network small {
  display: block;
  margin-top: 3px;
  color: #aabbd3;
  font-size: 12px;
}

.sound-flyout-heading,
.sound-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sound-flyout-heading {
  justify-content: space-between;
  margin-bottom: 12px;
  color: #dce7f8;
  font-size: 13px;
}

.sound-flyout-heading span {
  color: #aabbd3;
  font-size: 12px;
}

.sound-slider-row button {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: transparent;
  color: #dce7f8;
}

.sound-slider-row button:hover { background: #2c4364; }

.sound-slider-row input {
  flex: 1;
  accent-color: var(--accent-color);
}

/* Pushes the system-status cluster (Wi-Fi, sound, clock, …) to the right. */
.task-spacer { flex: 1; }

/* Generic visibility utility — .hidden beats .window because it appears
   later in the stylesheet at the same specificity. */
.hidden { display: none; }

/* ===========================================================================
   8. RESPONSIVE TWEAKS
   Below 900 px we widen windows slightly and shrink fixed-width sidebars
   so more of the app body remains visible.
   ========================================================================= */

@media (max-width: 900px) {
  .window { left: 10%; width: 80%; }
  .start-menu { width: 410px; }
  .settings-nav,
  .file-sidebar { width: 150px; }
  .settings-nav { flex-basis: 150px; }
  .calculator-history { width: 190px; }
  .calendar-details { width: 220px; }
}



@media (max-height: 850px) {
  .desktop-icons {
    grid-auto-flow: column;
    grid-template-rows: repeat(5, max-content);
    column-gap: 8px;
  }
}